' AddItemToProgMan ' ' This is a Word for Windows macro which allows you to add the current document to the specified ' Program Manager Group. This was written for Word for Windows v2.0, but it may also work in ' Word for Windows v1.0 and v1.1 as well. I haven't tested it, so I don't know. ' ' To install this macro, do the following: ' ' 1. open this document in Word for Windows. ' 2. select (i.e. highlight) the entire document and select Edit, Copy (Ctrl-Ins) ' 3. Select "Macros..." from the "Tools" menu (Alt-O, M) ' 4. Type in a macro name (e.g. "AddItemToProgMan") ' 5. Push the "Edit" button (Alt-E) ' 6. Paste the macro in the buffer. ' 7. Close the window, saving changes. ' 8. If you want, assign it to a key ' 9. When you exit, make sure to save changes to the global glossary Sub MAIN Begin Dialog UserDialog 410, 170, "Add Item to Program Manager" Text 10, 6, 231, 13, "Add Item to Program Manager:" Text 47, 25, 73, 13, "Filename:" Text 47, 45, 40, 13, "Title:" Text 47, 66, 52, 13, "Group:" Text 47, 88, 40, 13, "Icon:" CheckBox 135, 112, 139, 16, "Save Changes", .Save OKButton 105, 135, 88, 21 CancelButton 211, 135, 88, 21 TextBox 135, 22, 262, 18, .Filename$ TextBox 135, 43, 262, 18, .Title$ TextBox 135, 64, 262, 18, .Group$ TextBox 135, 85, 263, 18, .Icon$ End Dialog n$ = LCase$(FileName$()) m$ = n$ q$ = Chr$(34) ' remove path from filename For i = 1 To Len(n$) If Mid$(n$, i, 1) = "\" Then m$ = Right$(n$, Len(n$) - i) Next i ' remove extension from filename i = InStr(m$, ".") If i > 0 Then m$ = Left$(m$, i - 1) Dim dlg As UserDialog dlg.Group$ = GetProfileString$("Add To Group") If dlg.Group$ = "" Then dlg.Group$ = "Documents" dlg.Icon$ = GetProfileString$("Add Using Icon") If dlg.Icon$ = "" Then dlg.Icon$ = "\win\icons\doc.ico" dlg.Filename$ = LCase$(FileName$()) dlg.Title$ = m$ n = Dialog(dlg) If n = - 1 Then ChanNum = DDEInitiate("PROGMAN", "PROGMAN") If ChanNum = 0 Then MsgBox "Unable to initiate DDE conversation with ProgMan", "Error" return Else window$ = WindowName$() AppActivate "Program Manager", 1 DDEExecute ChanNum, "[ShowGroup(" + dlg.Group$ + ",6)]" ' minimize DDEExecute ChanNum, "[ShowGroup(" + dlg.Group$ + ",1)]" ' restore cmd$ = "[AddItem(" + dlg.Filename$ + "," + q$ + dlg.Title$ + q$ + "," + dlg.Icon$ + ")]" DDEExecute ChanNum, cmd$ ' add file to group DDEExecute ChanNum, "[ShowGroup(" + dlg.Group$ + ",6)]" ' minimize DDETerminate ChanNum ' terminate discussion Activate window$ EndIf If dlg.Save Then SetProfileString "Add To Group", dlg.Group$ SetProfileString "Add Using Icon", dlg.Icon$ EndIf EndIf End Sub